<?php
require_once 'connectSQL.php';
$sql = "select roleid,name from user where loginName='{$_POST['loginName']}' and password='{$_POST['password']}'" ;
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
	switch ($row['roleid']){
		case '1':
			header('Location: ./../admin/index.php?userName='.$row['name']); 
			break;
		case '2':
			header('Location: ./../user/index.php'); 
			break;
		default:
			header('Location: ./../index.php'); 
	}
}